int sbStatus[MAX_STOCKBOYS];//(-1 when not in an aisle)
Lock *aisleHelpLock[MAX_AISLES];
Condition aisleHelpCV[MAX_AISLES];
int aisleHelpLine[MAX_AISLES];
Lock *sbStatusLock;
Lock *sbLock[MAX_STOCKBOYS];
Condition *sbCV[MAX_STOCKBOYS];
void stockboy(int myIndex)
{
  //exit the stock room-go to myAisle
  sbStatusLock->Acquire();
  sbStatus[myIndex] = myAisle;
  sbStatusLock->Release();//in the Aisle
  for(int i=0;i<10;i++)//10 is an estimation, it may be a value from 5 to 20-still needs experiments
  {
    currentThread->Yield();
  }
  //restock item code here
  //check for customers needing help
  aisleHelpLock[myAisle]->Acquire();
  while(aisleHelpLine[myAisle]>0)
  {
    //there is customer needing help
    aisleHelpCV[myAisle]->Signal(aisleHelpLock[myAisle]);
    aisleHelpLine[myAisle]--;
    sbStatusLLock->Acquire();
    aisleHelpLock[myAisle]->Release();
    stockboy must change their status so customer knows they are ready to help in the customer aisle
    sbStatus[myIndex]=sbStatus[myIndex]+10;
    sbLock[myIndex]->Acquire();
    sbStatusLock->Release();
    sbCV[myIndex]->Wait(sbLock[myIndex]);
    //stockboy is waiting for the customer needed item number
    //...........
  }
  //..................
}


void customer(int myIndex)
{
  //......
  //I need help-look for stockboy
  sbStatusLock->Acquire();
  for(int i=0;i<MAX_AISLES;i++)
  {
    aisleHelpLock[i]->Acquire();
    for(int j=0;j<MAX_STOCKBOYS;j++)
    {
      if(sbStatus[j]==i)
      {
        helpAisle=i;
        aisleHelpLine[helpAisle]++;
        break;
      }
    }
    aisleHelpLock[i]->Release();
  }
  //if I didn't find a stockboy
  if(helpAisle==-1)
  {
    //do service button stuff
  }
  else
  {
    //found a stock boy in an aisle
  }
  sbStatusLock->Release();
  aisleHelpLine[helpAisle]++;
  aisleHelpCV[helpAisle]->Wait(aisleHelpLock[helpAisle]);
  //now find an avaible stockboy
  sbStatusLock->Acquire();
  //search the array for helpAisle+10. 
  //Save that index in a local variable(myStockBoy). 
  //Subtract 10 from their value
  sbStatusLock->Release();
  sbLock[myStockBoy]->Acquire();
  //set my item # in a stockboy specific monitor variable,
  //signal the stockboy and then wait for the aisle number
  //......
}
